<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<head>
	<title>二手资源交换网</title>
	<link rel="stylesheet" type="text/css" href="<%=path %>/content/images/layout.css" />
	<!-- <%=path%>/content/images/theme/beige/theme.css -->
	<link type="text/css" rel="stylesheet" href="<%=path%>/content/jq-ui/jquery-ui-1.8.custom.css" />
	<!-- JQuery库 -->
	<!-- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> -->
	<script type="text/javascript" src="<%=path%>/content/js/jquery-1.4.2.min.js"></script>
	
	<script type="text/javascript" src="<%=path %>/content/js/jquery.doubleSelect.min.js"></script>
	<!-- JQuery UI 插件 -->
	<!-- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>-->
	<script type="text/javascript" src="<%=path%>/content/jq-ui/jquery-ui-1.8.custom.min.js" ></script>
	
	<!-- JQuery 上传插件 -->
<script type="text/javascript" src="<%=path%>/content/jq-ajaxupload/ajaxupload.js"></script>

<!-- highslide -->
<link type="text/css" rel="stylesheet" href="<%=path%>/content/jq-highslide/highslide.css" />
<script type="text/javascript" src="<%=path%>/content/jq-highslide/highslide-full.min.js"></script>
<script type="text/javascript" src="<%=path%>/content/js/highslide-init.js"></script>

<script type="text/javascript" src="<%=path%>/content/js/jquery.scrollTo-min.js"></script>
	
	<!-- 常用库，确保这段代码在最下方 -->
	<script type="text/javascript" src="<%=path%>/content/js/common.js"></script>

	<script language="javascript" type="text/javascript">
	
	$(document).ready(function() {
		initHighslide("<%=path%>", "840", "640");
	});

	function addNewGoods(obj) {
		var cbox = document.getElementsByName('goods.state');
		if(cbox[0].checked == true){
			var html = '<div id="ex"><label>你想要交换的类型：</label><select name="gsType"><c:forEach items="${goodsType}" var="gst"><option value="${gst.name}">${gst.name}</option></c:forEach></select> <a href="#" onclick="return delGoods(this)">删除</a></div>';
			$("#" + obj).append(html);
			$("#addone").append('<a href="#" onclick="return addGoods(' + obj + ');" >添加一项</a>');
		}
		else{
			$("#" + obj).find("div").remove();
			$("#addone").find("a").remove();
		}
	};
	
	function addGoods(obj) {
		var html = '<div id="ex"><label>你想要交换的类型：</label><select name="gsType"><c:forEach items="${goodsType}" var="gst"><option value="${gst.name}">${gst.name}</option></c:forEach></select> <a href="#" onclick="return delGoods(this)">删除</a></div>';
		$(obj).append(html);
	}

	function delGoods(obj) {
		$(obj).parent().remove();
		return false;
	};
</script>
</head>
<body>

<div id="main_container">
<jsp:include page="../../header.jsp"></jsp:include>
<div class="center_content">
	<div class="center_left">
        	<jsp:include page="/WEB-INF/notice.jsp"></jsp:include>
         
	<div class="features">   
        <form class="form" action="<%=path %>/goods/addGoods" method="post">
		<p><label>货品名称：</label>
		<input type="text" name="goods.name" />
		</p>
		<p><label>货品类型：</label>
			<select name="gtid">  
				<c:forEach items="${goodsType}" var="gst">
					<option value="${gst.id}">${gst.name}</option>
				</c:forEach>
			</select>
		</p>
		<label>货品图片：</label>
		<a onclick="return hs.htmlExpand(this, { objectType: 'iframe' } )" href="<%=path%>/image/goUploadImage">上传图片</a>
		<!-- 上传成功后，图片将插到这里。 -->
		<div id="pic">
		<p>
			<img class="m_small" src="<%=path %>/content/images/nopic.jpg" style = "width:150px;height:150px;" />
			<input id="oriFileName" type="hidden" name="image.oriFileName" value=""/>
			<input id="bigFileName" type="hidden" name="image.bigFileName" value=""/>
			<input id="bigFileUrl" type="hidden" name="image.bigFileUrl" value=""/>
			<input id="minFileName" type="hidden" name="image.minFileName" value=""/>
			<input id="minFileUrl" type="hidden" name="image.minFileUrl" value=""/>
		</div>
		<p><label>描述内容：</label>
		<textarea class="textarea" name="goods.content" rows="5" cols="50"></textarea>
		</p>
		<p>	货品数量：
		<input class="w_small" type="text" name="goods.quantity" value="1"/>
		<span class="m_min"> 交换单价：<input class="w_small" type="text" name="goods.value" value="0"/></span>
		</p>
		<p id="addone">
		
		<input id="chk_exchange" type="checkbox" name="goods.state" value="1" onclick="return addNewGoods('exchange');"/> <label for="chk_exchange">我还想用来交换</label>
		</p>
		<div id="exchange"></div>
		<input type="submit" value="添加"/>
		</form>

        
	</div>
         
           
            
            
</div> 

<jsp:include page="../../sidebar.jsp"></jsp:include>
<div class="clear"></div> 
</div>
<jsp:include page="../../footer.jsp"></jsp:include>
</div>

</body>
</html>